<?php

namespace app\common\model\wechat;


use app\common\model\BaseModel;
use think\db\Query;

class WechatBaseModel extends BaseModel
{
    /**
     * 定义全局的查询范围
     * @var string[]
     */
    protected $globalScope = [
//        'plaid',
    ];

    /**
     * 过滤被删除的用户
     * @param $query
     */
    public function scopePlaid(Query $query)
    {
        $query->where('plaid', '=', get_plaid());
    }

    public function scopeHasPlaid(Query $query)
    {
        $query->where($query->getTable() . '.plaid', '=', get_plaid());
    }
}